package com.cheney.demo.stream.lesson1;


import com.cheney.demo.stream.Project;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author biezhi
 * @date 2018/2/11
 */
public class Java8 {

    public static void main(String[] args) {
        List<Project> projects = Project.buildData();
        List<String> names = projects.stream()
                .filter(p -> {
                    return p.getStars() > 1000;
                })
                .map(p -> {
                    return p.getName();
                })
                .limit(3)
                .collect(Collectors.toList());

        names.forEach(System.out::println);
    }

}
